export class VersionUtils {
    /**
     * 转换为程序版本
     */
    static toVerProcess(cbMainVer: number, cbSubVer: number, cbBuildVer: number): number {
        return ((cbMainVer) << 16) + ((cbSubVer) << 8) + (cbBuildVer);
    }
    /**
     * 转换 x.x.x => number
     */
    static toVerNumber(version: string): number {
        let v_ary = version.split(".");
        return this.toVerProcess(parseInt(v_ary[0]), parseInt(v_ary[1]), parseInt(v_ary[2]));
    }

    /**
     * 转换 number => x.x.x
     */
    static toVerString(dwProcessVer: number): string {
        var cbMainVer = dwProcessVer >> 16 & 0xff;
        var cbSubVer = dwProcessVer >> 8 & 0xff;
        var cbBuildVer = dwProcessVer & 0xff;
        return "" + cbMainVer + "." + cbSubVer + "." + cbBuildVer;
    }

}